package com.pumpkin.annotationdemo.reflection;

import com.sun.org.apache.bcel.internal.generic.NEW;

public class Test05 {
    static {
        System.out.println("main被加载");
    }
    public static void main(String[] args) throws ClassNotFoundException {

        //主动引用
        // Son son = new Son();

        //反射也会产生主动引用
        // Class.forName("com.pumpkin.annotationdemo.reflection.Son");

        //不会产生类的引用的方法
        // System.out.println(Son.b);

        Son[] array = new Son[5];

        //在链接的时候就被放在常量池中
        System.out.println(Son.M);
    }
}

class Father {
    static int b = 2;
    static {
        System.out.println("F父类被加载");
    }
}

class Son extends Father {
    static {
        System.out.println("S子类被加载");
        m = 300;
    }
    static int m = 100;
    static final int M = 1;
}
